package {
	import flash.display.MovieClip;
	import flash.display.StageScaleMode
	import flash.events.ProgressEvent;
	import flash.events.Event;
	
	public class MainAppPreloader extends MovieClip {
		public function MainAppPreloader():void {
			stop();
			this.stage.showDefaultContextMenu = false;
			this.stage.scaleMode = StageScaleMode.NO_SCALE;
			this.stage.tabChildren = false;
			this.stage.stageFocusRect = false;
			this.stage.focus = stage;
			this.stage.quality = "high";
			this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
			this.loaderInfo.addEventListener(Event.COMPLETE, compliteHandler);
		}
		
		private function progressHandler(event:ProgressEvent):void {
			loadBar.scaleX = event.bytesLoaded / event.bytesTotal;
		}
		
		private function compliteHandler(event:Event):void {
			this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progressHandler);
			this.loaderInfo.removeEventListener(Event.COMPLETE, compliteHandler);
		}
	}
}